package cn.iocoder.yudao.module.forward.dal.mysql.license;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.forward.dal.dataobject.license.LicenseDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.forward.controller.admin.license.vo.*;

/**
 * 授权码 Mapper
 *
 * @author zhang
 */
@Mapper
public interface LicenseMapper extends BaseMapperX<LicenseDO> {

    default PageResult<LicenseDO> selectPage(LicensePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LicenseDO>()
                .likeIfPresent(LicenseDO::getClientName, reqVO.getClientName())
                .eqIfPresent(LicenseDO::getFirmId, reqVO.getFirmId())
                .eqIfPresent(LicenseDO::getSerial, reqVO.getSerial())
                .eqIfPresent(LicenseDO::getTypeId, reqVO.getTypeId())
                .eqIfPresent(LicenseDO::getRegistered, reqVO.getRegistered())
                .betweenIfPresent(LicenseDO::getRegisterTime, reqVO.getRegisterTime())
                .eqIfPresent(LicenseDO::getGroupId, reqVO.getGroupId())
                .eqIfPresent(LicenseDO::getClientId, reqVO.getClientId())
                .eqIfPresent(LicenseDO::getLicense, reqVO.getLicense())
                .betweenIfPresent(LicenseDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LicenseDO::getId));
    }

}